import statics from "./statics";
import methods from "./methods";

( function( global, factory ) {
	"use strict";
	if ( typeof module === "object" && typeof module.exports === "object" ) {
		module.exports = global.document ?
			factory( global, true ) :
			function( w ) {
				if ( !w.document ) {
					throw new Error( "psoon requires a window with a document" );
				}
				return factory( w );
			};
	} else {
		factory( global );
	}
// Pass this if window is not defined yet
})( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  const PSoon = function(selector, data){
    return new PSoon.fn._init( selector, data );
  }
  PSoon.fn = PSoon.prototype = {
    constructor: PSoon,
    setData( data ){
    },
    ...methods
  }
  const init = PSoon.fn._init = function( selector, data ){
    return this
  }
  init.prototype = PSoon.fn;
  // create template
  Object.assign( PSoon, statics )



  var isWindow = function isWindow( obj ) { 
    return obj != null && obj === obj.window;
  };  
  if(isWindow(window)){
    window.PSoon = PSoon;
    window.$$ = window.$$ || PSoon
  }
  return PSoon;
})